﻿namespace Yaaf.Wp7.AdvancedExplorer
{
    using System;
    using System.Reflection;

    using Yaaf.Wp7.AdvancedExplorer.Resources;

    public class InfoViewModel
    {
        public InfoViewModel()
        {
            InfoText = AppResources.Infotext;
            ProjectLink = "http://sites.google.com/site/yaafdevelopers/";
            ProjectFeedbackLink = "http://advancedexplorer.idea.informer.com/";
            VersionText = string.Format(AppResources.InfoVersion, GetCurrentVersionNumber());
            ContactText = AppResources.InfoContactQuestion;
            EmailAddress = "developer.yaaf@googlemail.com";
        }

        public string EmailAddress { get; set; }
        public string EmailAddressLink 
        { 
            get
            {
                return "mailto:" + EmailAddress;
            } 
        }

        public string ProjectLink { get; set; }
        public string ProjectFeedbackLink { get; set; }
        public string InfoText { get; set; }
        public string VersionText { get; set; }

        public string ContactText { get; set; }

        public static Version GetVersionNumber(Assembly assembly)
        {
            AssemblyName assemblyName = new AssemblyName(assembly.FullName);
            return assemblyName.Version;
        }

        public static Version GetCurrentVersionNumber()
        {
            return GetVersionNumber(Assembly.GetExecutingAssembly());
        }
    }
}